/*package com.itheima.smspringboot.exception;

//*
全局异常捕获器
//*

import com.itheima.smspringboot.common.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice("com.itheima.smspringboot.controller")
public class GloabalExceptionHandler {
    public static final Logger logger = LoggerFactory.getLogger(GloabalExceptionHandler.class);

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result error(Exception e){
        logger.error("系统异常",e);
        return Result.error("系统异常");
    }


    @ExceptionHandler(CustomerExpception.class)
    @ResponseBody
    public Result adminExpception(CustomerExpception e){
        logger.error("自定义异常",e);
        return Result.error(e.getCode(),e.getMsg());
    }
}*/
